<template>
  <div class="main-container">
    <el-container>
      <el-aside :width="isCollapse ? '64px' : '200px'">
        <div class="toggle-button" @click="toggleCollapse">
          <el-icon><Fold v-if="!isCollapse"/><Expand v-else/></el-icon>
        </div>
        <el-menu
          :collapse="isCollapse"
          background-color="#304156"
          text-color="#fff"
          active-text-color="#409EFF"
        >
          <el-menu-item index="1">
            <el-icon><DataLine /></el-icon>
            <span>数据分析</span>
          </el-menu-item>
          <el-menu-item index="2">
            <el-icon><Setting /></el-icon>
            <span>系统设置</span>
          </el-menu-item>
        </el-menu>
      </el-aside>
      
      <el-container>
        <el-main>
          <div class="filter-section">
            <data-filter @filter-change="handleFilterChange"/>
          </div>
          <div class="table-section">
            <data-table :data="tableData"/>
          </div>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { Fold, Expand, DataLine, Setting } from '@element-plus/icons-vue'
import DataFilter from '../components/DataFilter.vue'
import DataTable from '../components/DataTable.vue'

const isCollapse = ref(false)
const tableData = ref([])

const toggleCollapse = () => {
  isCollapse.value = !isCollapse.value
}

const handleFilterChange = (filters) => {
  // 根据筛选条件更新表格数据
  console.log('筛选条件：', filters)
}
</script>

<style scoped>
.main-container {
  height: 100vh;
}

.el-aside {
  background-color: #304156;
  transition: width 0.3s;
}

.toggle-button {
  height: 30px;
  line-height: 30px;
  text-align: center;
  cursor: pointer;
  color: #fff;
  background-color: #1f2d3d;
}

.filter-section {
  margin-bottom: 20px;
}

.table-section {
  background-color: #fff;
  padding: 20px;
  border-radius: 4px;
}
</style>
